/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.psc.controllers;

import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.inject.Named;
import org.primefaces.push.PushContext;
import org.primefaces.push.PushContextFactory;

/**
 *
 * @author ahmed
 */
@Named
@RequestScoped
public class TestBean {

    private List<String> a = new ArrayList<>();
    private List<String> b = new ArrayList<>();
    private List<List<String>> all = new ArrayList<>();
    private String text;
    private String summary;
    private String detail;

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public void send() {
        System.out.println("summary-"+summary+" and details:"+detail);
        PushContext pushContext = PushContextFactory.getDefault().getPushContext();
        pushContext.push("/notifications", new FacesMessage(summary, detail));
    }

    public List<List<String>> getAll() {
        return all;
    }

    public void setAll(List<List<String>> all) {
        this.all = all;
    }

    public TestBean() {
        a.add("a1");
        a.add("a2");
        a.add("a3");
        a.add("a4");
        b.add("b1");
        b.add("b2");
        b.add("b3");
        b.add("b4");
        all.add(a);
        all.add(b);

    }

    /**
     * @return the a
     */
    public List<String> getA() {
        return a;
    }

    /**
     * @param a the a to set
     */
    public void setA(List<String> a) {
        this.a = a;
    }

    /**
     * @return the b
     */
    public List<String> getB() {
        return b;
    }

    /**
     * @param b the b to set
     */
    public void setB(List<String> b) {
        this.b = b;
    }

}
